Systems and methods for genotyping with graph reference

ABSTRACT

Genomic references are structured as a reference graph that represents diploid genotypes in organisms. A path through a series of connected nodes and edges represents a genetic sequence. Genetic variation within a diploid organism is represented by multiple paths through the reference graph. The graph may be transformed into a traversal graph in which a path represents a diploid genotype. Genetic analysis using the traversal graph allows an organism&#39;s diploid genotype to be elucidated, e.g., by mapping sequence reads to the reference graph and scoring paths in the traversal graph based on the mapping to determine the path through the traversal graph that best fits the sequence reads.

TECHNICAL FIELD

The invention relates to medical genetics and the analysis of genetic data.

BACKGROUND

Genotyping is the process of characterizing genetic variations in an individual, population, or ecological sample. Genotyping has typically been performed by performing biological assays and comparing the results to a reference genome, e.g., by restriction fragment length polymorphism identification (RFLPI) of genomic DNA, polymerase chain reaction (PCR), and DNA sequencing. More recently, genotyping has been transformed by the development of next-generation sequencing (NGS) technologies. The standard approach to variant discovery and genotyping from NGS data has been to map NGS sequence reads to a linear reference genome to identify positions where the sample contains variations.

Mapping NGS reads to a linear reference genome has limitations. First, the sample may contain sequences absent or divergent from the reference genome, e.g., through horizontal transfer events in microbial genomes, or at highly diverse loci, such as the classical HLA genes. In those cases, short reads either cannot or are unlikely to map correctly to the reference. Second, reference sequences (particularly of higher eukaryotes) are often incomplete, notably in telomeric and pericentromeric regions. Reads from missing regions will often map, sometimes with apparently high certainty, to paralogous regions, potentially leading to false variant calls. Third, methods for variant calling from mapped reads typically focus on a single variant type. However, where variants of different types cluster, focusing on a single type can lead to errors, for example, through incorrect alignment around indel polymorphisms. Fourth, although there are methods for detecting large structural variants, these cannot determine the exact location, size, or allelic sequence of variants. Finally, NGS mapping approaches typically ignore prior information about genetic variation within the species.

SUMMARY

The invention provides genomic references structured as reference graphs that can store genetic sequences from multiple organisms and that are transformed into traversal graphs that represent diploid genotypes of organisms. A reference graph includes nodes connected by edges in which the edges represent sequence data. A path through a series of connected nodes and edges represents a genetic sequence from a chromosome of an organism. Genetic variation within a diploid organism, within a population, or both, may be represented by multiple paths through a reference graph. The reference graph may be transformed into a traversal graph.

A traversal graph includes nodes connected by edges in which a path through the edges represents a diploid genotype. Genetic analysis using the traversal graph takes advantage of relationships between two different haploid genotypes in diploid organisms. Two separate haploids may be naturally related such that determining that one of the haploids traverses a specific branch of the reference graph gives information about the probability that the other haploid traverses certain branches. A simple example would be for a mutation known to be lethal when homozygous. When reads from a living organism traverse a branch from the reference graph corresponding to that mutation, it is highly probably that at least some reads from that organism will traverse another branch at that locus. The traversal graph represents valid diploid genotypes and evidence is used to assign scores or weights to edges in the traversal graph to indicate a likelihood of the genotypes. Use of the traversal graph allows an organism's diploid genotype to be elucidated (e.g., by mapping NGS sequence reads to the reference graph, assigning scores to corresponding branches of the traversal graph, and selecting the path through the traversal graph with the best score). Since the reference graph represents genetic variation across populations, sequence reads from a subject may be analyzed against all known alleles and indels to correctly identify each haploid genotype in the subject. Since edges in the traversal graph represent diploid genotypes and edge weights represent probabilities of those diploid genotypes, a diploid genotype for the subject may be identified and reported by following the highest-weighted path through the traversal graph, as given by mapping the reads to the corresponding reference graph. Since the true diploid genotype may be reported by mapping reads to the reference graph and following the highest-scoring corresponding path through a traversal graph, the analysis of genetic information such as sequence reads is uncoupled from the narrow perspective imposed by the use of a linear reference.

In certain aspects, the invention provides methods of determining a genotype of an organism. Methods include providing a reference graph comprising nodes connected by edges into a plurality of paths—the plurality of paths including a first path representing a first haplotype A and a second path representing a second haplotype B—and identifying one or more genotypes corresponding to either of both of the first haplotype A and the second haplotype B. Methods further include assigning, based on genetic information from the organism, scores to the one or more identified genotypes and identifying a genotype having a highest score in the assigning step, thereby providing the genotype. The genetic information from the organism may include a plurality of sequence reads. The reference graph may be provided within a tangible memory subsystem of a hardware computer system, and the steps may be performed using a processor of the computer system, the processor coupled to the tangible memory subsystem. Preferably the nodes connected by the edges are stored in the tangible memory subsystem using adjacency lists comprising pointers to physical locations in the memory. In some embodiments, the assigning and following steps are performed using dynamic programming, e.g., using by using a shortest path algorithm, such as Dijkstra's algorithm.

In preferred embodiments, the identified genotypes include a first genotype AA, a second genotype AB, and a third genotype BB. Preferably, a method of the invention includes representing the first genotype AA, the second genotype AB, and the third genotype BB using a traversal graph comprising nodes connected by edges into a plurality of paths, the plurality of paths including a first traversal path representing the first genotype AA, a second traversal path representing the second genotype AB, and a third traversal path representing the third genotype BB. The method may further include determining weights for the first traversal path, the second traversal path, and the third traversal path based on numbers of the sequence reads that map to those paths. Identifying which of the first genotype AA, the second genotype AB, and the third genotype BB has the highest score relative to a reference may be done using dynamic programming (e.g., using Dijkstra's algorithm) to determine a most probable path through the traversal graph.

In some embodiments, A represents an allele of a gene known to be dominant and B represents an allele of the gene known to be recessive. Where the organism is a patient, the method may include providing a report for the patient that provides genotype analysis.

Aspects of the invention provide systems for determining a genotype of a subject. A preferred system has a reference graph stored therein, the reference graph comprising nodes connected by edges into a plurality of paths, the plurality of paths including a first path representing a first haplotype A and a second path representing a second haplotype B. The system also has instructions stored therein that when executed by the system cause the system to: identify one or more genotypes corresponding to either or both of the first haplotype A and the second haplotype B, assign—based on genetic information from the organism—scores to the one or more identified genotypes, and identify a genotype having a highest score in the assigning step, thereby providing the genotype. The genetic information from the organism may include a plurality of sequence reads. Preferably, the system includes a tangible memory subsystem wherein the reference graph is kept and a processor coupled to the tangible memory subsystem that executes the instructions. The nodes connected by the edges may be stored in the tangible memory subsystem using adjacency lists comprising pointers to physical locations in the memory. The assigning and identifying steps may be performed using dynamic programming using, e.g., Viterbi decoding. In preferred embodiments, the identified genotypes include a first genotype AA, a second genotype AB, and a third genotype BB. Preferably, the system represents the first genotype AA, the second genotype AB, and the third genotype BB using a traversal graph comprising nodes connected by edges into a plurality of paths, the plurality of paths including a first traversal path representing the first genotype AA, a second traversal path representing the second genotype AB, and a third traversal path representing the third genotype BB; and determines weights for the first traversal path, the second traversal path, and the third traversal path based on numbers of the sequence reads that map to those paths. Identifying which of the first genotype AA, the second genotype AB, and the third genotype BB has the highest score may include using dynamic programming to determine a most probable path through the traversal graph, e.g., via Dijkstra's algorithm.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 shows a simple reference graph.

FIG. 2 shows an embodiment of a traversal graph representing the possible states of the reference graph.

FIG. 3 diagrams a method of genotyping using a graph data structure.

FIG. 4 shows a possible reference graph.

FIG. 5 gives a traversal graph built from the reference graph of FIG. 4.

FIG. 6 shows a single reference graph and a corresponding traversal graph.

FIG. 7 illustrates a computer system for performing methods of the invention.

FIG. 8 shows the use of an adjacency list for each vertex.

FIG. 9 shows the use of an adjacency list for each vertex and edge.

FIG. 10 illustrates a method of generating sequence reads from a sample.

FIG. 11 illustrates finding alignments between a sequence and a reference graph.

FIG. 12 shows the matrices that represent the comparison.

FIG. 13 diagrams a method for determining a genotype of a subject.

FIG. 14 illustrates a report that may be generated.

DETAILED DESCRIPTION

Systems and methods disclosed herein use reference graphs to store genetic sequences from multiple organisms. A reference graph includes nodes connected by edges in which the edges represent sequence data. A path through a series of connected nodes and edges in the reference graph represents a genetic sequence from a chromosome of an organism. Genetic variation within a diploid organism, within a population, or both, may be represented by multiple paths through a reference graph. The reference graph is transformed into a traversal graph that represents possible diploid genotypes of one or more organisms. A traversal graph includes nodes connected by edges in which a path through the edges represents a diploid genotype.

Genotyping Using Graph Data Structures

Some of the limitations in traditional methods can be addressed by genotyping using graph data structures. In a reference graph representation of a genome, such as a directed acyclic graph (DAG), genetic variations within species can be incorporated as divergent paths along the graph. Sequence reads map to edges or paths through the reference graph, and then genotyping can be performed by simply counting the number of reads across each path. Because the sequence reads are aligned to the reference graph which includes known variations, the subsequent step of identifying mutations by comparing to a table of known mutations can be eliminated. Further, alignment to reference graphs results in greatly improved results for larger structural variants, as well as indels and SNPs located near structural variants. Additionally, in some cases there may be no need to perform a variant calling step because an ideal reference graph will not have any mismatches from the sequence read (of course variant calling can still be performed to detect unknown variations).

Genotyping using graphs also allows for computational complexities and considerations. The present disclosure recognizes that genotyping using graphs can be performed by enumerating, in an interval between two nodes of the reference graph connected by edges representing possible haplotypes, the possible genotypes from the possible haplotypes; scoring each of the genotypes based on a plurality of observed sequence reads mapped to each edge; and then using dynamic programming to determine the most likely genotype.

FIG. 1 shows a simple reference graph 101 having two paths α and β connecting nodes 1 and 2. The reference graph 101 is shown as a directed acyclic graph (DAG) and it may be preferable to use a directed graph to represent genetic information. Path α represents a SNP, whereas path β represents the canonical reference sequence. For an individual having two copies of each chromosome (i.e., two haploids), the individual's diploid genotype may be selected from one of three possible states: αα (both chromosomes include α), αβ (only one chromosome includes α), or ββ (no variation).

Identifying the most likely state or genotype can be performed by considering the weight of evidence provided by genetic information from an organism. Any suitable type of genetic information from the organism may be used. In some embodiments, the genetic information from the organism is provided by an alignment file containing mapped sequencing reads. (Such evidence can include various properties of mapped sequence reads, such as position on a reference genome or graph; the number of mapped sequence reads at a given position; and qualities of mapped sequence reads, such as individual base quality, mapping quality, and the like.) One approach is to identify the two most probable paths in the reference graph 101, which reflect the two most probable genotypes. However, this problem becomes more complicated by the fact that the two most probable paths have a relationship between them. Two separate haploids may be naturally related such that determining that one of the haploids traverses a specific branch of the reference graph gives information about the probability that the other haploid traverses certain branches. A simple example would be for a mutation known to be lethal when homozygous. When reads from a living organism traverse a branch from the reference graph corresponding to that mutation, it is highly probably that other reads from that organism traverse a branch that does not include the mutation. Thus in a sense, two separate haploids have knowledge of one another; the act of one of a pair of haploids traversing a branch may change the probability of the second of the pair traversing that branch. Normally, this is a problem that is difficult to overcome. It is noted that in the case of a reference graph, all paths typically converge back to a base or reference branch, representing the canonical reference sequence (e.g., the hg38 reference genome). Methods of the invention may be used to leverage the property of a pair haploids by which traversal of a branch by one of the pair may change the probability of the second of the pair traversing that branch. In this example, that property can be leveraged to represent the states of all possible genotypes as nodes in a separate graph. That separate graph is here referred to as a traversal graph because each edge in the traversal graph represents a state of two haploids, i.e., a pair of edges traversed by two haploids in a reference graph. The traversal graph represents all possible valid states for possible genotypes in the reference graph.

FIG. 2 shows a traversal graph 201 representing the possible states of the reference graph 101. The traversal graph 201 has the first and second nodes connected by three edges, each edge representing a possible state of the possible diploid genotypes possible from the reference graph 101, i.e., αα, αβ, and ββ. In other words, the traversal graph identifies all possible states of genotypes between the first and second nodes in the reference graph. Genotyping now becomes identifying which path through the traversal graph 201 is the most likely path for a particular organism, e.g., by considering evidence in the form of sequence reads in an alignment file mapping to edges in the reference graph 101.

FIG. 3 diagrams a method 301 of genotyping using a graph data structure. At a high level, the method 301 includes identifying 303 all possible genotypes in an interval of a reference graph. An interval can refer to a region in a reference graph in which there are at least two paths (e.g., by a pair of edges or vertices) representing variation from a reference sequence. For example, an interval can begin at a transition point in which two branches diverge from a node, and end at a transition point in which two branches rejoin at a node. Similarly, an interval can span a region in which there are a plurality of overlapping paths. However, an interval can also comprise a region between any two positions in a reference graph.

Assuming a single path through the reference graph (such as the reference graph 101 of FIG. 1) represents potential alleles along a single haploid chromosome, a diploid genotype will comprise a pair of paths through the reference graph. Each such possible diploid genotype is represented 307 as an edge in a traversal graph, and a full traversal graph is built by connecting the edges in a manner such that any path through the graph represents a possible full diploid genotype for an organism. Using some suitable technique (e.g., mapping sequence reads or correlating alleles to phenotypes), scores are assigned 311 to edges in the traversal graph indicating likelihoods of the corresponding genotype.

Evidence can be used to assign scores or weights to edges in the graph, thus indicating the likelihood of that genotype. For example, each of the states for the traversal graph 201 of FIG. 2 can be represented by a probability density function φ_(αβ), having non-zero states φ_(αβ) (2,0), φ_(αβ) (1,1), and φ_(αβ) (0,2) (wherein the integers in each tuple represent the number of chromosomes following each path). One may then assign the values of each probability density function for each state as weights to the edges in the graph, thus representing the probability of that genotype. The most likely genotype may then be selected based on the scores, i.e., by following 315 the highest scores along edges in the traversal graph. (Similarly, the scores may be negative logged such that genotyping may be performed by following the lowest scores. In both cases, the scores represent the likelihood of a particular genotype.)

A genotype can refer to the presence or absence of a single variation in one or both chromosomes. Accordingly, in the example above, a genotype refers to whether an individual has the genotype αα, αβ, or ββ. However, a genotype can also refer to the presence or absence of a plurality of variations in one or both chromosomes. Accordingly, once the probabilities have been set for a traversal graph representing multiple possible variations, one may use dynamic programming to identify the genotype for the plurality of variations by traversing the graph and following those edges with the highest probability. The single path having the highest probability yields the genotype for that individual. Thus, finding the highest scoring path through the traversal graph yields the genotype for a genomic sample, and is akin to finding two separate paths through the reference DAG.

Constructing a Traversal Graph

As noted above, each edge of a traversal graph can represent two haploid paths in a reference graph. Accordingly, a simple graph having two nodes connected by two edges (one edge representing the reference sequence β and the other edge representing a variant α), can be represented by a traversal graph having two nodes connected by three edges representing the possible genotype states of the reference graph.

However, constructing a traversal graph can be more complicated. As previously noted, genomic reference graphs typically comprise a base or backbone sequence representing the canonical genomic reference (e.g., GRCh38/hg38 for human; GRCm38/mm10 for mouse; CSAC 2.1.4/panTro4 for chimpanzee). Known variations, such as single nucleotide polymorphisms (SNPs), small insertions and deletions (indels), and larger structural variants (SVs) are represented as edges which provide a path that directs away from the backbone sequence and then reconnects at a later position. In complex regions of the graph with high variation, the number of possible genotypes in an interval increases due to the increased number of available combinations for two chromosomes.

For example, FIG. 4 shows a subsection of a possible reference graph 401. In the reference graph 401, four positional nodes {1 . . . 4} are connected by six edges {a . . . f}. (When considered in the context of a genomic reference graph representing an entire genome, nodes 1 and 4 may be connected to additional nodes representing a backbone or reference sequence for that genome.) As shown in this embodiment, the first node (1) includes two outgoing edges representing either the backbone or reference sequence “C” which connects to the second node (2, and a deletion (“−”) of three nucleotides reconnecting with the backbone at the fourth node (4). The second node (2) includes two outgoing edges representing the reference sequence “A” which connects to the third node (3), and a deletion (“−”) of two nucleotides reconnecting with the backbone at the fourth node (4). Similarly, the third node (3) includes two outgoing edges representing the reference sequence “C” which connects to the fourth node (4), and a deletion (“−”) of one nucleotide reconnecting with the backbone at the fourth node (4).

Four haploid paths may be taken through the graph 401. The reference sequence or backbone path is “CAT” (passing through the edges connecting nodes 1, 2, 3, and 4). Another path presents a deletion of the entire reference sequence (“−”) (by traversing the edge connecting nodes 1 and 2). Another path represents a deletion of AT (“C−”) (by traversing a path connecting nodes 1, 2, and 4), and the last available path represents a deletion of only the final T (“CA−”) (by traversing an alternate path connecting nodes 1, 2, 3, and 4).

Between each positional node, we define an interval, such that the reference graph 401 has three intervals I∈{1,2,3}. All of the edges ε_(i) overlapping each interval are identified, each of which represents a contribution to the reference genome. Each edge has a traversal value t_(i)∈[0,1,2], which represents whether the edge can be traversed by 0, 1, or 2 of the chromosomes in a sample.

Once all of the edges and traversal values have been collected, a traversal graph 501 may be constructed, as shown in FIG. 5. First, a state S of each interval is defined as a labelling of the t-values of these edges in a valid manner, i.e., S={t₀=0, t_(i)=1, . . . }, subject to the constraint that Σ_(i)t_(i)=2 (indicating that there may only be two possible taken paths in a genomic sample, representing each chromosome). For interval I1, the possible paths comprise a2, a1b1, and b2. For interval I2, the possible paths comprise a2, a1c1, a1d1, c2, c1d1, and d2. For interval I3, the possible paths comprise a2, a1c1, a1e1, a1f1, c2, c1e1, c1f1, e2, f2, and e1f1.

FIG. 5 gives a traversal graph 501 built from the reference graph 401. Each edge in the traversal graph 501 represents an edge {a . . . f} or combination of edges of the reference graph 401, and whether the edge or edges are followed by 1 or 2 of the chromosomes in the sample. In the example, there are four possible haplotypes (in the reference graph 401), leading to ten unique paths representing each possible genotype. Each genotype is represented by a single path through the traversal graph 501. The traversal graph may be built by enumerating the number of possible states in each interval, determining the possible combinations of states between intervals, and creating a graph having edges and nodes that provides paths which correctly convey these possible states. In this way, each path through the traversal graph represents a possible diploid genotype of an organism.

The traversal graph 501 of FIG. 5 can be generated from the reference graph 401 of FIG. 4 in the following manner. Begin with interval I1 in the reference graph 401, which has possible genotypes a2, a1b1, and b2. For each possible genotype, create a directed edge and associate the edge with the genotype. As each of these genotypes begins from the first node (1) in the graph 401, create a node representing the first node (1) in the graph 501 and connect each of these edges to this node. Thus, the traversal graph 501 indicates that there are three possible genotypes between the first node (1) and the second node (2).

The second interval I2 has 6 possible genotypes from the collected edges in the reference graph 401: a2, a1c1, a1d1, c2, c1d1, and d2. Similarly, create edges and associate each edge with one of these genotypes. However, in the reference graph 401, note that only certain genotypes from interval I2 may be combined with genotypes from interval I1. For example, there is no possible genotype a2 that may be combined with d2. Accordingly, to include only those possible genotypes in the traversal graph 501, create multiple second nodes (2) to connect those edges from intervals I1 and I2 such that each connected pair of edges represents a possible genotype across intervals I1 and I2. In this way, only possible genotypes are represented in the traversal graph 501.

This process may similarly be repeated for interval I3 (having 10 possible genotypes, as shown), creating multiple third nodes (3) to connect the edges from interval I2 with those from I3. Finally, each of the edges from interval I3 may reconnect with a single node (4), as each of the possible paths in the reference graph 401 of FIG. 4 converge back to the base branch after interval I3. Each possible pair of paths from node 1 to node 4 in the reference graph 401 is now represented by a single path through the traversal graph 401. Accordingly, the geometry of the traversal graph 501 is constructed such that invalid paths or combinations of paths in the reference graph 401 are omitted.

While not shown here, the traversal graph 501 may include additional nodes and edges corresponding to additional genotypes in the reference graph 401 (e.g., those genotypes represented by paths upstream or downstream of the reference graph 401). Once the traversal graph 501 has been constructed, genotyping can be performed by scoring each of the edges. Scoring can be performed by considering evidence provided by sequence reads aligned to edges in the reference graph 401, for example. The most likely path can then be determined by identifying the most likely or shortest path, e.g., by a dynamic programming approach. This can be performed in a variety of ways, of which the following is one example.

Setting Expected Probabilities for Each State

The alignment, or positioning, of next-generation sequencing reads on a reference genome is typically modelled using either a negative binomial distribution or a Poisson distribution. In this example, the latter is chosen. First, the expected probability of reads mapping to edges given each possible state S is determined. Assume that a sample of next-generation sequencing reads are randomly distributed (i.e., ignore any potential GC bias or other related effects). In a sample having coverage k with read length L, a read is expected to start every k/L bases. This observation can form the basis for predicting an expected number of reads N that should be observed in a region having length α. The expected number of reads N overlapping this region and the number of reads beginning in this region are counted. The reads overlapping must start within the distance L before this region, so the problem becomes finding the expected number of reads starting in an interval of L+α. According to the Poisson distribution, the expected number of reads N of length L at least partially overlapping an interval of length a in a sample of coverage K is:

$\begin{matrix} {N = \frac{\left( {L + \alpha} \right)K}{L}} & (1) \end{matrix}$

Using Equation (1), the likelihood or probability of sequence reads mapping to each edge of a reference graph given each possible state can be determined. Given the length λ_(i) of each branch (e.g., measured by the number of nucleotides in the branch), the average length L of the sequence reads, and the t-values for each state (S={t₀=0, t₁=1, . . . }), the expected probabilities for the distribution of sequencing reads along each path can be defined in vector form:

$\begin{matrix} {{\overset{\_}{p}❘\lambda_{1}},\lambda_{2},{{\ldots\mspace{14mu}\lambda_{N}};t_{1}},t_{2},\ldots\mspace{11mu},{t_{N} = {\frac{\delta_{2,{t_{1} + t_{2} + \mspace{11mu}{\ldots\mspace{14mu} t_{N}}}}}{\sum\limits_{i}^{\;}{t_{i}\left( {L + \lambda_{i}} \right)}}\left( {{t_{1}\left( {L + \lambda_{1}} \right)},{t_{2}\left( {L + \lambda_{2}} \right)},\ldots\mspace{11mu},{t_{N}\left( {L + \lambda_{N}} \right)}} \right)}}} & (2) \end{matrix}$ (Note that the factor K/L from Equation (1) above is cancelled out from each dimension.)

In practical use, the vector simplifies considerably for all valid states. There will either be 1 or 2 non-zero terms, depending on whether the edge state is homozygous or heterozygous (i.e., there is only one edge with t_(i)=2, or two with t_(i)=1, t_(j)=1. This is due to the implicit assumption that reads cannot map from elsewhere to these edges. Consequently, the actual vector is tunably perturbed so as to give the zero states a small probability.

FIG. 6 shows a single reference graph 601 and a corresponding traversal graph 605. In the depicted reference graph 601, path t₁ may be 50 base pairs long and path t₂ may be 30 base pairs long. Given a sequence read length of 100 base pairs, the probability vector for state {t₁=2, t₂=0} is {0, 1}; {t₁=1, t₂=1} is {0.454, 0.545}; and {t₁=0, t₂=2} is {0, 1}.

Identifying Weights for Traversal Graph Based on Evidence

The expected probabilities for each state can be compared with those exhibited by the evidence, i.e., the actual aligned sequence reads in an alignment file. For example, Bayes Theorem may be used to determine the probability of a particular state S given a set of aligned sequence reads R:

$\begin{matrix} {{P\left( {S❘R} \right)} = \frac{{P(S)}{P\left( {R❘S} \right)}}{P(R)}} & (3) \end{matrix}$ (In certain examples, a learned prior probability for the state may be incorporated, but in the disclosed model this is not used.) Abbreviating Equation (3) yields P(SIR)∝P(RIS). A normalized version of this abbreviation may be used to determine the probability of each of the valid states for a given interval, i.e., the most likely genotype of a sample: P(S)∝Π_(i) p _(i) ^(N) ^(i)   (4) where p_(i) is from the vector given by Equation (2), and N_(i) represents the number of sequence reads mapping to the corresponding edge. The term on the right hand side of Equation (4) may initially be addressed using a multinomial distribution stated in the following way. Imagine one is receiving aligned sequencing reads. The reads can map to one of the edges in a reference graph having several states. If the total number of aligned sequencing reads is large, the probability of a given state is given by Equation (4), with p_(i) being the estimated proportion of reads for each edge given by Equation (2), and N_(i) being the actual mapped number of reads drawn for each edge.

The result of P(S) will be higher for those states which are better supported by the evidence in the alignment file. The results for each state may then be assigned as scores for each genotype, such as by assigning weights to each edge of the traversal graph. To find the most likely genotype, the highest scoring edges are followed to obtain a single path which represents the genotype, e.g., by using dynamic programming. Similarly, the scores may be negative logged such that the lowest score represents the most likely genotype. The problem of genotyping then becomes finding the shortest path in the traversal graph, i.e., finding the path that minimizes the sum of the weights. Finding the shortest path according to weights in a graph is a well-known problem. Common algorithms for finding the shortest path include Dijkstra's algorithm, for example.

Dijkstra's algorithm and Viterbi's algorithm are examples of dynamic programming approaches that can be used to perform genotyping according to the disclosure. Dynamic programming refers to methods of solving a complex problem by breaking it down into a collection of simpler subproblems, solving each of those subproblems only once, and storing their solutions (also referred to as “memoization”). In this way, each memoized solution does not need to be re-solved the next time it is needed. Dynamic programming algorithms can be used for optimization, such as finding the shortest paths between two nodes in a graph. For example, Dijkstra's algorithm can be used to solve the shortest path problem in a successive approximation scheme. To apply Dijkstra's algorithm, use a computer system to let the node deemed to be a starting node be called the initial node. Let the distance of node Y be the distance from the initial node to Y. Under Dijkstra's algorithm, the computer system will assign some initial distance values and will try to improve them step by step. First, assign to every node a tentative distance value: set it to zero for our initial node and to infinity for all other nodes. Second, set the initial node as current. Mark all other nodes unvisited. Create a set of all the unvisited nodes called the unvisited set. Third, for the current node, consider all of its unvisited neighbors and calculate their tentative distances. Compare the newly calculated tentative distance to the current assigned value and assign the smaller one. For example, if the current node A is marked with a distance of 6, and the edge connecting it with a neighbor B has length 2, then the distance to B (through A) will be 6+2=8. If B was previously marked with a distance greater than 8 then change it to 8. Otherwise, keep the current value. Fourth, when all of the neighbors of the current node have been considered, mark the current node as visited and remove it from the unvisited set. A visited node will never be checked again. Fifth, if the destination node has been marked visited (when planning a route between two specific nodes) or if the smallest tentative distance among the nodes in the unvisited set is infinity (when planning a complete traversal; occurs when there is no connection between the initial node and remaining unvisited nodes), then stop. The algorithm has finished. Sixth and finally, otherwise, select the unvisited node that is marked with the smallest tentative distance, set it as the new “current node”, and go back to the third step. More information regarding the use of Dijkstra's algorithm in a dynamic programming context can be found in Sniedovich, 2006, Dijkstra's algorithm revisited: the Dynamic Programming Connexion, Control and Cybernetics 25(3), the contents of which are incorporated by reference.

Incorporating Mapping Qualities

In some embodiments, mapping qualities from the sequence read alignment are incorporated. For example, a large number of low quality mappings to an edge should be less persuasive than a smaller number of reads mapping to a location with high precision. This can be added to the state probabilities as suggested by the multinomial distribution in Equations (3) and (4): P(t ₁ ,t ₂ , . . . t _(N)|reads)=Π_(i) ^(N) p _(i)|λ₁,λ₂, . . . λ_(N) ;t ₁ ,t ₂ , . . . t _(N) ^(N) ^(i) ,  (5) where N_(i) is the number of reads mapped to each edge, and p_(i) (as defined by Equation (2)) are approximated. Approximating p_(i), comprises sampling reads from each edge such that each read is sampled proportional to the mapping quality of each read. The state probabilities may then be averaged over these samplings. Other measures of mapping quality and read quality could also be used. For example, individual base call qualities (e.g., Phred scores) could be incorporated, or the number of bases a given read has that overlap a given branch. Additional Methods

As previously noted, methods of genotyping according to the disclosure can identify the most likely genotype for a genomic sample using a variety of dynamic programming techniques. Dynamic programming is a method for solving a complex problem by breaking it down into a collection of smaller problems, solving the smaller problems once, and then storing their solutions. In this way, methods according to the disclosure score each possible subset of a full genotype, and then select the most likely full genotype by subsequently evaluating the scores. For the simple SNP example given above, this can comprise simply evaluating the most likely genotype from those available. However, for more complex situations (such as the multiple deletion example above) and for genotyping larger portions of the reference graph comprising multiple consecutive positional nodes, a dynamic programming algorithm, such as Dijkstra's algorithm, can be used to identify the most likely genotype.

However, the disclosure is not meant to be so limited. For example, another embodiment according to the disclosure employs a hidden state model instead of a traversal graph. In such a model, each possible diploid genotype in an interval represents a hidden state. Intervals are identified from the reference graph based on transition or branching positions in which branches diverge from or rejoin nodes. The observations in the model would be the mapping configurations (e.g., positions, quality) of sequence reads on that corresponding interval in the reference graph. The most likely hidden state (i.e., diploid genotype) may then be determined based on the emission probabilities (which are mapped to the edge lengths in the traversal graph) and can be calculated from the observations. Allowed transitions between states are deduced at the end of each interval and then the transition probabilities can be deduced by ensuring that the probabilities of allowed transitions sum to one. One could then use the Viterbi algorithm to identify the most probable sequence of hidden states based on the observations. The feature in common is the enumeration of the possible genotypes given a plurality of haplotypes from a reference graph, scoring each of the genotypes based on a plurality of observed sequence reads mapped to each haplotype, and then determining the most likely genotype. For genotypes including a plurality of variations, dynamic programming can be used to determine the most likely genotype. For example, the Viterbi algorithm is a dynamic programming algorithm for finding the most likely sequence of hidden states, called the Viterbi path that results in a sequence of observed events, especially in the context of Markov information sources and hidden Markov models. For background, see Stanke et al., 2006, AUGUSTUS: Ab initio prediction of alternative transcripts, Nucl Ac Res 34:w435-9; U.S. Pub. 2014/0025312; and U.S. Pub. 2013/0080068, each incorporated by reference.

Thus it can be seen that embodiments of the invention provide a method 301 of determining a genotype from a plurality of haplotypes. In one embodiment, the method includes using a reference graph having a plurality of vertices and a plurality of edges, the plurality of vertices including a first vertex and a second vertex, the plurality of edges including a first edge connecting the first vertex and the second vertex, and a second edge connecting the first vertex and the second vertex. The method further includes associating haplotypes in the plurality of haplotypes to respective edges in the plurality of edges, the associating comprising associating a first haplotype in the plurality of haplotypes to the first edge and a second haplotype in the plurality of haplotypes to the second edge; identifying 303 a plurality of genotypes from the plurality of haplotypes, the identifying comprising identifying a first genotype comprising the first haplotype, a second genotype comprising the first haplotype and the second haplotype, and a third genotype comprising the second haplotype; assigning 311 scores to each genotype of the plurality of genotypes, the scoring considering at least in part a plurality of sequence reads mapped to the plurality of edges; and selecting the most likely genotype from the plurality of genotypes based on the score for each genotype, for example, by following 315 highest scores along edges in the traversal graph.

In some embodiments, selecting the most likely genotype from the plurality of genotypes based on the score for each genotype further comprises using dynamic programming to determine the most likely genotype. Using dynamic programming to determine the most likely genotype may include using Viterbi decoding.

In certain embodiments of method 301, scoring each genotype of the plurality of genotypes comprises: associating the plurality of genotypes to a traversal graph, the traversal graph comprising a second plurality of vertices and a second plurality of edges, the plurality of vertices comprising a third vertex and a fourth vertex, the third vertex and fourth vertexes connected by a third edge, and fourth edge, and a fifth edge, the associating comprising associating the first genotype to the third edge, the second genotype to the fourth edge, and the third genotype to the fifth edge; and determining weights for each of the second plurality of edges at least in part by determining a first weight for the third edge based on a plurality of sequence reads mapped to the first edge, determining a second weight for the fourth edge based on a plurality of sequence reads mapped to the first edge and the second edge, and determining a third weight for the fifth edge based on a plurality of sequence reads mapped to the second edge. Selecting the most likely genotype from the plurality of genotypes based on the score for each genotype may include using dynamic programming to identify the most probable path through the traversal graph. Using dynamic programming to identify the most probable path may include using Dijkstra's algorithm.

FIG. 7 illustrates a computer system 701 suitable for performing methods of the invention. The system 701 includes at least one computer 433. Optionally, the system 701 may further include one or more of a server computer 409 and a sequencer 455, which may be coupled to a sequencer computer 451. Each computer in the system 701 includes a processor coupled to a memory device and at least one input/output device. Thus the system 701 includes at least one processor coupled to a memory subsystem (e.g., a memory device or collection of memory devices 475). Using those mechanical components, the system 701 is operable to obtain a sequence generated by sequencing nucleic acid from a genome of a patient. In certain embodiments, the system uses the processor to transform known genomic sequences and variations into a reference graph. However, in other embodiments, the reference graph may be a previously existing graph and transferred to the system 701 by disk or network. Similarly, the system 701 may use the processor to: transform a reference graph into a traversal graph, such as the traversal graph 1215; enumerate possible diploid genotypes; score the diploid genotypes according to evidence in the form of aligned sequence reads; and use dynamic programming to determine a full genotype from the scored genotypes.

Processor refers to any device or system of devices that performs processing operations. A processor will generally include a chip, such as a single core or multi-core chip, to provide a central processing unit (CPU). A processor may be provided by a chip from Intel or AMD. A processor may be any suitable processor such as the microprocessor sold under the trademark XEON E7 by Intel (Santa Clara, Calif.) or the microprocessor sold under the trademark OPTERON 6200 by AMD (Sunnyvale, Calif.).

The memory subsystem 475 contains one or any combination of memory devices. A memory device is a mechanical device that stores data or instructions in a machine-readable format. Memory may include one or more sets of instructions (e.g., software) which, when executed by one or more of the processors of the disclosed computers can accomplish some or all of the methods or functions described herein. Preferably, each computer includes a non-transitory memory device such as a solid state drive, flash drive, disk drive, hard drive, subscriber identity module (SIM) card, secure digital card (SD card), micro SD card, or solid-state drive (SSD), optical and magnetic media, others, or a combination thereof.

Using the described components, the system 701 is operable to produce a report and provide the report to a user via an input/output device. An input/output device is a mechanism or system for transferring data into or out of a computer. Exemplary input/output devices include a video display unit (e.g., a liquid crystal display (LCD) or a cathode ray tube (CRT)), a printer, an alphanumeric input device (e.g., a keyboard), a cursor control device (e.g., a mouse), a disk drive unit, a speaker, a touchscreen, an accelerometer, a microphone, a cellular radio frequency antenna, and a network interface device, which can be, for example, a network interface card (NIC), Wi-Fi card, or cellular modem.

Preferably, graphs according to the disclosure (such as reference graphs and traversal graphs) are stored in the memory subsystem 475 using adjacency lists or index-free adjacency, which may include pointers to identify a physical location in the memory subsystem 475 where each vertex is stored. In a preferred embodiment, the graph is stored in the memory subsystem 475 using adjacency lists. In some embodiments, there is an adjacency list for each vertex. For discussion of implementations see ‘Chapter 4, Graphs’ at pages 515-693 of Sedgewick and Wayne, 2011, Algorithms, 4th Ed., Pearson Education, Inc., Upper Saddle River N.J., 955 pages, the contents of which are incorporated by reference and within which pages 524-527 illustrate adjacency lists.

In certain embodiments, the system 701 performs operations in parallel. For example, portions of a reference graph can be split into separate graphs, and traversal graphs for each separate graph are then identified simultaneously in parallel using multiple processors. The traversal graphs are subsequently rejoined once the operations are complete. Similarly, other features, such as scoring genotypes based on mapped sequence reads, can be performed in parallel.

FIG. 8 shows the use of an adjacency list 801 for each edge 805 in a graph, such as a hypothetical portion of a reference graph 815. The system 701 uses a processor to create the graph 815 that includes vertex objects 805 and edge objects 809 through the use of adjacency, i.e., adjacency lists or index free adjacency. Thus, the processor may create the graph 815 using index-free adjacency wherein an edge 805 includes a pointer to another edge 805 to which it is connected and the pointer identifies a physical location in on a memory device 475 where the connected vertex is stored. The graph 815 may be implemented using adjacency lists such that each vertex or edge stores a list of such objects that it is adjacent to. Each adjacency list comprises pointers to specific physical locations within a memory device for the adjacent objects. The graph 815 may be any of the reference graphs or traversal graphs shown herein and all such graphs may be stored using adjacency lists according to the strategems set out in FIGS. 8 and 9.

In the top part of FIG. 8, the graph 815 is illustrated in a cartoon-like visual-friendly format. The graph 815 will typically be stored on a physical device of memory subsystem 475 in a fashion that provide for very rapid traversals. In that sense, the bottom portion of FIG. 8 is not cartoon-like and represents that objects are stored at specific physical locations on a tangible part of the memory subsystem 475. Each edge 805 is stored at a physical location, the location of which is referenced by a pointer in any adjacency list 801 that references that node. Each edge 805 has an adjacency list 801 that includes every adjacent edge in the graph 815. The entries in the list 801 are pointers to the adjacent nodes.

In certain embodiments, there is an adjacency list for each vertex and edge and the adjacency list for a vertex or edge lists the edges or vertices to which that vertex or edge is adjacent. Similarly, each edge may be associated with a weight or score representing the likelihood of the diploid genotype represented by that edge.

FIG. 9 shows the use of an adjacency list 801 for each edge 805 and node 809. As shown in FIG. 9, system 701 creates the graph 815 using an adjacency list 801 for each vertex and edge, wherein the adjacency list 801 for an edge 805 or node 809 lists the edges or vertices to which that vertex or edge is adjacent. Each entry in adjacency list 801 is a pointer to the adjacent vertex or edge. (Node and vertex are used synonymously.)

Preferably, each pointer identifies a physical location in the memory subsystem at which the adjacent object is stored. In the preferred embodiments, the pointer or native pointer is manipulatable as a memory address in that it points to a physical location on the memory and permits access to the intended data by means of pointer dereference. That is, a pointer is a reference to a datum stored somewhere in memory; to obtain that datum is to dereference the pointer. The feature that separates pointers from other kinds of reference is that a pointer's value is interpreted as a memory address, at a low-level or hardware level. The speed and efficiency of the described graph engine allows a sequence to be queried against a large-scale graph representing millions or billions of bases, using a computer system 701. Such a graph representation provides means for fast random access, modification, and data retrieval.

In some embodiments, fast random access is supported and graph object storage are implemented with index-free adjacency in that every element contains a direct pointer to its adjacent elements (e.g., as described in U.S. Pub. 2014/0280360 and U.S. Pub. 2014/0278590, each incorporated by reference), which obviates the need for index look-ups, allowing traversals (e.g., as done in the modified SW alignment operation described herein) to be very rapid. Index-free adjacency is another example of low-level, or hardware-level, memory referencing for data retrieval (as required in alignment and as particularly pays off in terms of speed gains in the modified, multi-dimensional Smith-Waterman alignment described below). Specifically, index-free adjacency can be implemented such that the pointers contained within elements are references to a physical location in memory.

Since a technological implementation that uses physical memory addressing such as native pointers can access and use data in such a lightweight fashion without the requirement of separate index tables or other intervening lookup steps, the capabilities of a given computer, e.g., any modern consumer-grade desktop computer, are extended to allow for full operation of a genomic-scale graph (i.e., a reference graph that represents all loci in a substantial portion of the genome). Thus storing graph elements (e.g., nodes and edges) using a library of objects with native pointers or other implementation that provides index-free adjacency actually improves the ability of the technology to provide storage, retrieval, and alignment for genomic information since it uses the physical memory of a computer in a particular way.

While no specific format is required for storage of a graph, FIGS. 8 and 9 are presented to illustrate useful formats. In some embodiments, methods of the invention use the stored graph with sequence reads that are obtained from a subject. In some embodiments, sequence reads are obtained as an electronic article, e.g., uploaded, emailed, or FTP transferred from a lab to system 701. In certain embodiments, sequence reads are obtained by sequencing.

FIG. 10 illustrates obtaining 123 a set of sequence reads 705 from a sample 703. As a preliminary step (not depicted), nucleic acid may be isolated and/or enriched.

In certain embodiments, sequence reads are obtained by performing sequencing 713 on a sample 703 from a subject (however in some embodiments, sequence reads are obtained when a read file is transferred into a system of the invention). Sequencing may be by any method and sequencing instrument known in the art. See, generally, Quail, et al., 2012, A tale of three next generation sequencing platforms: comparison of Ion Torrent, Pacific Biosciences and Illumina MiSeq sequencers, BMC Genomics 13:341. DNA sequencing techniques include classic dideoxy sequencing reactions (Sanger method) using labeled terminators or primers and gel separation in slab or capillary, sequencing by synthesis using reversibly terminated labeled nucleotides, pyrosequencing, 454 sequencing, Illumina/Solexa sequencing, allele specific hybridization to a library of labeled oligonucleotide probes, sequencing by synthesis using allele specific hybridization to a library of labeled clones that is followed by ligation, real time monitoring of the incorporation of labeled nucleotides during a polymerization step, polony sequencing, and SOLiD sequencing.

A sequencing technique that can be used includes, for example, use of sequencing-by-synthesis systems and sequencing instruments sold under the trademarks GS JUNIOR, GS FLX+ and 454 SEQUENCING by 454 Life Sciences, a Roche company (Branford, Conn.), and described by Margulies, M. et al., Genome sequencing in micro-fabricated high-density picotiter reactors, Nature, 437:376-380 (2005); U.S. Pat. Nos. 5,583,024; 5,674,713; and U.S. Pat. No. 5,700,673, each incorporated by reference. 454 sequencing involves two steps. First, DNA is sheared into blunt-end fragments attached to capture beads and then amplified in droplets. Second, pyrosequencing is performed on each DNA fragment in parallel. Addition of nucleotides generates a light signal that is recorded by a CCD camera in a sequencing instrument.

Another sequencing technique and instrument that can be used is SOLiD technology by Applied Biosystems from Life Technologies Corporation (Carlsbad, Calif.). In SOLiD sequencing, genomic DNA is sheared into fragments, and adaptors are attached to generate a fragment library. Clonal bead populations are prepared in microreactors containing beads, primers, template, and PCR components. Following PCR, the templates are denatured and enriched and the sequence is determined by a process that includes sequential hybridization and ligation of fluorescently labeled oligonucleotides.

Another example of a DNA sequencing technique and instrument that can be used is ion semiconductor sequencing using, for example, a system sold under the trademark ION TORRENT by Ion Torrent by Life Technologies (South San Francisco, Calif.). Ion semiconductor sequencing is described, for example, in Rothberg, et al., An integrated semiconductor device enabling non-optical genome sequencing, Nature 475:348-352 (2011); U.S. Pubs. 2009/0026082, 2009/0127589, 2010/0035252, 2010/0137143, 2010/0188073, 2010/0197507, 2010/0282617, 2010/0300559, 2010/0300895, 2010/0301398, and 2010/0304982, each incorporated by reference. DNA is fragmented and given amplification and sequencing adapter oligos. The fragments can be attached to a surface. Addition of one or more nucleotides releases a proton (H+), which signal is detected and recorded in a sequencing instrument.

Another example of a sequencing technology that can be used is Illumina sequencing. Illumina sequencing is based on the amplification of DNA on a solid surface using fold-back PCR and anchored primers. Genomic DNA is fragmented and attached to the surface of flow cell channels. Four fluorophore-labeled, reversibly terminating nucleotides are used to perform sequential sequencing. After nucleotide incorporation, a laser is used to excite the fluorophores, and an image is captured and the identity of the first base is recorded. Sequencing according to this technology is described in U.S. Pub. 2011/0009278, U.S. Pub. 2007/0114362, U.S. Pub. 2006/0024681, U.S. Pub. 2006/0292611, U.S. Pat. Nos. 7,960,120, 7,835,871, 7,232,656, 7,598,035, 6,306,597, 6,210,891, 6,828,100, 6,833,246, and 6,911,345, each incorporated by reference.

Other examples of a sequencing technology that can be used include the single molecule, real-time (SMRT) technology of Pacific Biosciences (Menlo Park, Calif.) and nanopore sequencing as described in Soni and Meller, 2007 Clin Chem 53:1996-2001.

As shown in FIG. 10, sequencing 713 generates a set of sequence reads 705. Reads according to the invention generally include sequences of nucleotide data anywhere from tens to thousands of bases in length. A set of sequence reads 705 will typically be provided in a suitable format such as, for example, a FASTA or FASTQ file. FASTA is originally a computer program for searching sequence databases and the name FASTA has come to also refer to a standard file format. See Pearson & Lipman, 1988, Improved tools for biological sequence comparison, PNAS 85:2444-2448. A sequence in FASTA format begins with a single-line description, followed by lines of sequence data. The description line is distinguished from the sequence data by a greater-than (“>”) symbol in the first column. FASTQ files are similar to FASTA but further include a line of quality scores. Typically, sequence reads will be obtained 123 in a format such as FASTA, FASTQ, or similar.

In some embodiments, the sequence reads 705 are assembled to provide a contig or consensus sequence, which contig or consensus sequence may be used in finding alignments to a reference graph. Sequence assembly may include any suitable methods known in the art including de novo assembly, reference-guided assembly, others, or combinations thereof. In a preferred embodiment, sequence reads are assembled using graph-based alignment methods. See, e.g., U.S. Pub. 2015/0057946 and U.S. Pub. 2015/0056613, both incorporated by reference. Embodiments of a graph and its use are discussed in greater detail below. The result of assembly is a sequence representing the corresponding portion of the original nucleic acid. The contig or consensus sequence or one or more of individual sequence read 709 may be mapped to a reference graph to find an alignment with an optimal score.

In certain embodiments, each sequence read 709 is mapped to a reference graph and an alignment is found. As previously noted, alignments of sequence reads to a reference graph may be used as evidence to identify the likelihood of the possible diploid genotypes from an interval in a reference graph.

FIG. 11 illustrates finding alignments 1101 between a sequence read 709 and a reference graph 1115. Using alignment operations of the invention, reads 709 can be rapidly mapped to the reference graph 1115 despite their large numbers or short lengths. Numerous benefits obtain by using a graph as a reference. For example, aligning against a graph is more accurate than aligning against a linear reference and then attempting to adjust one's results in light of other extrinsic information. This is primarily because the latter approach enforces an unnatural asymmetry between the sequence used in the initial alignment and other information. Aligning against an object that potentially represents all the relevant physical possibilities is much more computationally efficient than attempting to align against a linear sequence for each physical possibility (the number of such possibilities will generally be exponential in the number of junctions). A modified Smith-Waterman operation for comparing a sequence to a reference graph is provided here as an extension of pairwise alignment methods.

Pairwise alignment generally involves placing one sequence along part of a target, introducing gaps according to an algorithm, scoring how well the two sequences match, and preferably repeating for various positions along the reference. The best-scoring match is deemed to be the alignment and represents an inference of homology between aligned portions of the sequences. In some embodiments, scoring an alignment of a pair of nucleic acid sequences involves setting values for the probabilities of substitutions and indels. When individual bases are aligned, a match or mismatch contributes to the alignment score by a substitution score, which could be, for example, 1 for a match and −0.33 for a mismatch. An indel deducts from an alignment score by a gap penalty, which could be, for example, −1. Gap penalties and substitution probabilities can be based on empirical knowledge or a priori assumptions about how sequences evolve. Their values affects the resulting alignment. Particularly, the relationship between the gap penalties and substitution probabilities influences whether substitutions or indels will be favored in the resulting alignment.

Stated formally, an alignment represents an inferred relationship between two sequences, x and y. For example, in some embodiments, an alignment A of sequences x and y maps x and y respectively to another two strings x′ and y′ that may contain spaces such that: (i) |x′|=|y′|; (ii) removing spaces from x′ and y′ should get back x and y, respectively; and (iii) for any i, x′[i] and y′[i] cannot be both spaces.

A gap is a maximal substring of contiguous spaces in either x′ or y′. An alignment A can include the following three kinds of regions: (i) matched pair (e.g., x′[i]=y′[i]; (ii) mismatched pair, (e.g., x′[i]≠y′[i] and both are not spaces); or (iii) gap (e.g., either x′[i . . . j] or y′[i . . . j] is a gap). In certain embodiments, only a matched pair has a high positive score a. In some embodiments, a mismatched pair generally has a negative score b and a gap of length r also has a negative score g+rs where g, s<0. For DNA, one common scoring scheme (e.g. used by BLAST) makes score a=1, score b=−3, g=−5 and s=−2. The score of the alignment A is the sum of the scores for all matched pairs, mismatched pairs and gaps. The alignment score of x and y can be defined as the maximum score among all possible alignments of x and y.

Any pair may have a score a defined by a 4×4 matrix B of substitution probabilities. For example, B(i,i)=1 and 0<B(i,j)<1 [for i≠j], is one possible scoring system. For instance, where a transition is thought to be more biologically probable than a transversion, matrix B could include B(C,T)=0.7 and B(A,T)=0.3, or other values desired or determined by methods known in the art.

A pairwise alignment, generally, involves—for sequence Q (query) having m characters and a reference genome T (target) of n characters—finding and evaluating possible local alignments between Q and T. For any 1≤i≤n and 1≤j≤m, the largest possible alignment score of T[h . . . i] and Q[k . . . j], where h≤i and k≤j, is computed (i.e. the best alignment score of any substring of T ending at position i and any substring of Q ending at position j). This can include examining all substrings with cm characters, where c is a constant depending on a similarity model, and aligning each substring separately with Q. Each alignment is scored, and the alignment with the preferred score is accepted as the alignment. One of skill in the art will appreciate that there are exact and approximate algorithms for sequence alignment. Exact algorithms will find the highest scoring alignment, but can be computationally expensive. Two well-known exact algorithms are Needleman-Wunsch (J Mol Biol, 48(3):443-453, 1970) and Smith-Waterman (J Mol Biol, 147(1):195-197, 1981; Adv. in Math. 20(3), 367-387, 1976). A further improvement to Smith-Waterman by Gotoh (J Mol Biol, 162(3), 705-708, 1982) reduces the calculation time from O(m^2n) to O(mn) where m and n are the sequence sizes being compared and is more amendable to parallel processing. In the field of bioinformatics, it is Gotoh's modified algorithm that is often referred to as the Smith-Waterman algorithm. Smith-Waterman approaches are being used to align larger sequence sets against larger reference sequences as parallel computing resources become more widely and cheaply available. See, e.g., Amazon's cloud computing resources. All of the journal articles referenced herein are incorporated by reference in their entireties.

The original Smith-Waterman (SW) algorithm aligns linear sequences by rewarding overlap between bases in the sequences, and penalizing gaps between the sequences. Smith-Waterman also differs from Needleman-Wunsch, in that SW does not require the shorter sequence to span the string of letters describing the longer sequence. That is, SW does not assume that one sequence is a read of the entirety of the other sequence. Furthermore, because SW is not obligated to find an alignment that stretches across the entire length of the strings, a local alignment can begin and end anywhere within the two sequences.

The original SW algorithm is expressed for an n×m matrix H, representing the two strings of length n and m, in terms of equation (1): H_k0=H_0l=0(for 0≤k≤n and 0≤1≤m) H_ij=max{H_(i−1,j−1)+s(a_i,b_j),H_(i−1,j)−W_in,H_(i,j−1)−W_del,0} (for 1≤i≤n and 1≤j≤m)  (1)

In the equations above, s(ai,bj) represents either a match bonus (when ai=bj) or a mismatch penalty (when ai≠bj), and insertions and deletions are given the penalties Win and Wdel, respectively. In most instances, the resulting matrix has many elements that are zero. This representation makes it easier to backtrace from high-to-low, right-to-left in the matrix, thus identifying the alignment.

Once the matrix has been fully populated with scores, the SW algorithm performs a backtrack to determine the alignment. Starting with the maximum value in the matrix, the algorithm will backtrack based on which of the three values (Hi−1,j−1, Hi−1,j, or Hi,j−1) was used to compute the final maximum value for each cell. The backtracking stops when a zero is reached. The optimal-scoring alignment may contain greater than the minimum possible number of insertions and deletions, while containing far fewer than the maximum possible number of substitutions.

SW or SW-Gotoh may be implemented using dynamic programming to perform local sequence alignment of the two strings, S and A, of sizes m and n, respectively. This dynamic programming employs tables or matrices to preserve match scores and avoid re-computation for successive cells. Each element of the string can be indexed with respect to a letter of the sequence, that is, if S is the string ATCGAA, S[1]=A.

Instead of representing the optimum alignment as Hi,j (above), the optimum alignment can be represented as B[j,k] in equation (2) below: B[j,k]=max(p[j,k],i[j,k],d[j,k],0) (for 0<j<m,0<k<n)  (2)

The arguments of the maximum function, B[j,k], are outlined in equations (3)-(5) below, wherein MISMATCH_PEN, MATCH_BONUS, INSERTION_PEN, DELETION_PEN, and OPENING_PEN are all constants, and all negative except for MATCH_BONUS (PEN is short for PENALTY). The match argument, p[j,k], is given by equation (3), below:

$\begin{matrix} \begin{matrix} {{p\left\lbrack {j,k} \right\rbrack} = {{\max\left( {{p\left\lbrack {{j - 1},{k - 1}} \right\rbrack},{i\left\lbrack {{j - 1},{k - 1}} \right\rbrack},{d\left\lbrack {{j - 1},{k - 1}} \right\rbrack}} \right)} +}} \\ {{MISMATCH\_ PEN},{{{if}\mspace{11mu}{S\lbrack j\rbrack}} \neq {A\lbrack k\rbrack}}} \\ {= {{\max\left( {{p\left\lbrack {{j - 1},{k - 1}} \right\rbrack},{i\left\lbrack {{j - 1},{k - 1}} \right\rbrack},{d\left\lbrack {{j - 1},{k - 1}} \right\rbrack}} \right)} +}} \\ {{MATCH\_ BONUS},{{{if}\mspace{11mu}{S\lbrack j\rbrack}} = {A\lbrack k\rbrack}}} \end{matrix} & (3) \end{matrix}$

the insertion argument i[j,k], is given by equation (4), below: i[j,k]=max(p[j−1,k]+OPENING_PEN,i[j−1,k],d[j−1,k]+OPENING_PEN)+INSERTION_PEN  (4)

and the deletion argument d[j,k], is given by equation (5), below: d[j,k]=max(p[j,k−1]+OPENING_PEN,i[j,k−1]+OPENING_PEN,d[j,k−1])+DELETION_PEN  (5)

For all three arguments, the [0,0] element is set to zero to assure that the backtrack goes to completion, i.e., p[0,0]=i[0,0]=d[0,0]=0.

The scoring parameters are somewhat arbitrary, and can be adjusted to achieve the behavior of the computations. One example of the scoring parameter settings (Huang, Chapter 3: Bio-Sequence Comparison and Alignment, ser. Curr Top Comp Mol Biol. Cambridge, Mass.: The MIT Press, 2002) for DNA would be:

MATCH_BONUS: 10

MISMATCH_PEN: −20

INSERTION_PEN: −40

OPENING_PEN: −10

DELETION_PEN: −5

The relationship between the gap penalties (INSERTION_PEN, OPENING_PEN) above help limit the number of gap openings, i.e., favor grouping gaps together, by setting the gap insertion penalty higher than the gap opening cost. Of course, alternative relationships between MISMATCH_PEN, MATCH_BONUS, INSERTION_PEN, OPENING_PEN and DELETION_PEN are possible.

In some embodiments, the methods and systems of the invention use a modified Smith-Waterman operation that involves a multi-dimensional look-back through a reference graph. Multi-dimensional operations of the invention provide for a “look-back” type analysis of sequence information (as in Smith-Waterman), wherein the look back is conducted through a multi-dimensional space that includes multiple pathways and multiple nodes. The multi-dimensional algorithm can be used to align sequence reads against the graph-type reference. That alignment algorithm identifies the maximum value for Ci,j by identifying the maximum score with respect to each sequence contained at a position on the graph. In fact, by looking “backwards” at the preceding positions, it is possible to identify the optimum alignment across a plurality of possible paths.

The modified Smith-Waterman operation described here, aka the multi-dimensional alignment, provides exceptional speed when performed in a genomic graph system that employs physical memory addressing (e.g., through the use of native pointers or index free adjacency as discussed above). The combination of multi-dimensional alignment to a reference graph with the use of spatial memory addresses (e.g., native pointers or index-free adjacency) improves what the computer system is capable of, facilitating whole genomic scale analysis to be performed using the methods described herein.

The operation includes aligning a sequence, or string, to a graph. For the purpose of defining the algorithm, let S be the string being aligned, and let D be the directed graph to which S is being aligned. The elements of the string, S, are bracketed with indices beginning at 1. Thus, if S is the string ATCGAA, S[1]=A, S[4]=G, etc.

In certain embodiments, for the graph, each letter of the sequence of a node will be represented as a separate element, d. In a preferred embodiment, node or edge objects contain the sequences and the sequences are stored as the longest-possible string in each object. A predecessor of d is defined as:

(i) If d is not the first letter of the sequence of its object, the letter preceding d in its object is its (only) predecessor;

(ii) If d is the first letter of the sequence of its object, the last letter of the sequence of any object that is a parent of d's object is a predecessor of d.

The set of all predecessors is, in turn, represented as P[d].

In order to find the “best” alignment, the algorithm seeks the value of M[j,d], the score of the optimal alignment of the first j elements of S with the portion of the graph preceding (and including) d. This step is similar to finding Hi,j in equation 1 above. Specifically, determining M[j,d] involves finding the maximum of a, i, e, and 0, as defined below: M[j,d]=max{a,i,e,0}  (6)

where

e=max{M[j, p*]+DELETE_PEN} for p* in P[d]

i=M[j−1, d]+INSERT_PEN

a=max{M[j−1, p*]+MATCH_SCORE} for p* in P[d], if S[j]=d;

max{M[j−1, p*]+MISMATCH_PEN} for p* in P[d], if S[j]≠d

As described above, e is the highest of the alignments of the first j characters of S with the portions of the graph up to, but not including, d, plus an additional DELETE_PEN. Accordingly, if d is not the first letter of the sequence of the object, then there is only one predecessor, p, and the alignment score of the first j characters of S with the graph (up-to-and-including p) is equivalent to M[j,p]+DELETE_PEN. In the instance where d is the first letter of the sequence of its object, there can be multiple possible predecessors, and because the DELETE_PEN is constant, maximizing [M[j, p*]+DELETE_PEN] is the same as choosing the predecessor with the highest alignment score with the first j characters of S.

In equation (6), i is the alignment of the first j−1 characters of the string S with the graph up-to-and-including d, plus an INSERT_PEN, which is similar to the definition of the insertion argument in SW (see equation 1).

Additionally, a is the highest of the alignments of the first j characters of S with the portions of the graph up to, but not including d, plus either a MATCH_SCORE (if the jth character of S is the same as the character d) or a MISMATCH_PEN (if the jth character of S is not the same as the character d). As with e, this means that if d is not the first letter of the sequence of its object, then there is only one predecessor, i.e., p. That means a is the alignment score of the first j−1 characters of S with the graph (up-to-and-including p), i.e., M[j−1,p], with either a MISMATCH_PEN or MATCH_SCORE added, depending upon whether d and the jth character of S match. In the instance where d is the first letter of the sequence of its object, there can be multiple possible predecessors. In this case, maximizing {M[j, p*]+MISMATCH_PEN or MATCH_SCORE} is the same as choosing the predecessor with the highest alignment score with the first j−1 characters of S (i.e., the highest of the candidate M[j−1,p*] arguments) and adding either a MISMATCH_PEN or a MATCH_SCORE depending on whether d and the jth character of S match.

Again, as in the SW algorithm, the penalties, e.g., DELETE_PEN, INSERT_PEN, MATCH_SCORE and MISMATCH_PEN, can be adjusted to encourage alignment with fewer gaps, etc.

As described in the equations above, the operation finds the optimal (e.g., maximum) value for a sequence reads 709 to the reference graph 1715 by calculating not only the insertion, deletion, and match scores for that element, but looking backward (against the direction of the graph) to any prior nodes on the graph to find a maximum score.

FIG. 12 shows the matrices that represent the comparison. The modified Smith-Waterman operation of the invention identifies the highest score and performs a backtrack to identify the proper alignment of the sequence. See, e.g., U.S. Pub. 2015/0057946 and U.S. Pub. 2015/0056613, both incorporated by reference. Systems and methods of the invention can be used to provide a report that identifies a modified base at the position within the genome of the subject. Other information may be found in Kehr et al., 2014, Genome alignment with graph data structures: a comparison, BMC Bioinformatics 15:99 and Lee, 2003, Generating consensus sequences from partial order multiple sequence alignment graphs, Bioinformatics 19(8):999-1008, both incorporated by reference. Thus, analyzing genomic information from nucleic acid from the sample 703 may include aligning one or more of the sequence reads 709 to the reference graph 1715 as shown in FIG. 11. The branches to which the reads 709 have been aligned are identified, along with the corresponding species.

FIG. 13 diagrams a method 1900 for determining a genotype of a subject. The method 1900 includes obtaining 1905 known sequences and transforming 1909 the known sequences into a reference graph. The known sequences are that set of available sequences that are used as reference material for analyzing the subject being studied. For example, all or a sampling of all available human genomes spanning the relevant portion (e.g., gene, operon, chromosome, or complete genome). The reference graph includes nodes connected by edges into a plurality of paths, the plurality of paths including a first path representing a first haplotype A and a second path representing a second haplotype B. The method 1900 includes identifying 1915 at least a first genotype AA, a second genotype AB, and a third genotype BB corresponding to the first haplotype A and the second haplotype B. Sequence reads are obtained and mapped 1923 to the reference graph. Sequence reads may be obtained by sequencing nucleic acid from a sample from a subject. The method 1900 includes assigning scores 1929 to each of the first genotype AA, the second genotype AB, and the third genotype BB, wherein the scores correspond to a result of mapping sequence reads from an organism to the reference graph and identifying for the organism a one of the first genotype AA, the second genotype AB, and the third genotype BB having a highest assigned score. Subsequent genotypes may be similarly scored, and the full genotype may then be determined using dynamic programming. A report is provided 1931 with the genotype of the organism.

The plurality of known sequences are stored as a reference graph comprising objects in the tangible memory subsystem, wherein matching homologous segments of the known sequences are each represented by a single object in the reference graph. Objects of the reference graph may include vertex objects connected by edge objects and an adjacency list for each vertex object and edge object, wherein the adjacency list for a vertex object or edge object lists the edge objects or vertex objects to which that vertex object or edge object is adjacent. Each entry in an adjacency list may be a pointer to the adjacent vertex object or edge object, wherein each pointer identifies a physical location in the memory subsystem at which the adjacent object is stored. In some embodiments, the reference graph uses index-free adjacency to link the objects into paths to represent the known sequences from the plurality of different species. Further discussion may be found in U.S. Pub. 2013/0073214; U.S. Pub. 2013/0345066; U.S. Pub. 2013/0311106; U.S. Pub. 2013/0059740; U.S. Pub. 2012/0157322; U.S. Pub. 2015/0057946 and U.S. Pub. 2015/0056613, each incorporated by reference for all purposes.

The method 101 further includes obtaining 123 a genetic sequence from an organism and finding alignments 127 between the genetic sequence and the plurality of known sequences from the plurality of different species. A report is provided that includes a description of a genotype of the organism based on a result of the aligning step.

FIG. 14 illustrates a report 2035 that may be generated by the system 701. The report 2035 was generated in this illustrated example by following the bottom-most path through the traversal graph 501 shown in FIG. 5. Thus the report 2035 includes a description of the determined genotypes (i.e., the full genotype) for some hypothetical organism.

Thus, genomic references are structured as a reference graph that represents genetic variation in organisms. A path through a series of connected nodes and edges represents a genetic sequence. Genetic variation within a diploid organism is represented by multiple paths through the reference graph. The graph may be transformed into a traversal graph in which a path represents a diploid genotype. Genetic analysis using the traversal graph allows an organism's diploid genotype to be elucidated, e.g., by mapping sequence reads to the reference graph and scoring paths in the traversal graph based on the mapping to determine the path through the traversal graph that best fits the sequence reads.

INCORPORATION BY REFERENCE

References and citations to other documents, such as patents, patent applications, patent publications, journals, books, papers, web contents, have been made throughout this disclosure. All such documents are hereby incorporated herein by reference in their entirety for all purposes.

EQUIVALENTS

Various modifications of the invention and many further embodiments thereof, in addition to those shown and described herein, will become apparent to those skilled in the art from the full contents of this document, including references to the scientific and patent literature cited herein. The subject matter herein contains important information, exemplification and guidance that can be adapted to the practice of this invention in its various embodiments and equivalents thereof. 

What is claimed is:
 1. A method of determining a genotype, the method comprising: providing a reference graph in computer memory, the reference graph representing a plurality of genomic sequences and comprising nodes connected by edges into a plurality of paths, wherein variation across the plurality of genomic sequences is incorporated as divergent paths converging to nodes representing conserved sequence, such that each of the plurality of genomic sequences is represented as a path in the reference graph; wherein the plurality of paths further comprises a first alternate path representing a first haplotype A at a position and a second alternate path representing a second haplotype B at the position, wherein each of the first and second alternate paths converge to a node representing a conserved sequence; identifying one or more genotypes corresponding to either or both of the first haplotype A and the second haplotype B, the one or more genotypes comprising a first genotype AA, a second genotype AB, and a third genotype BB; mapping a plurality of sequence reads from an organism to the reference graph, wherein the mapping comprises looking backwards to predecessor paths to identify an optimal location for a sequence read across multiple alternate paths; assigning, based on properties of the mapped plurality of sequence reads to the reference graph, scores to each of the identified genotypes, wherein the assigning considers whether a sequence read mapping to the first haplotype A changes the probability of the genotype including the second haplotype B; and identifying one of the first genotype AA, second genotype AB, or third genotype BB as having a highest score in said assigning step, thereby providing a genotype.
 2. The method of claim 1, wherein the properties of the mapped reads are selected from the group consisting of position, count, and quality.
 3. The method of claim 1, further comprising enumerating a plurality of genotypes based on a plurality of haplotypes in the reference graph, assigning scores to each genotype, and identifying a most likely sequence of genotypes for the organism using dynamic programming.
 4. The method of claim 3, wherein the dynamic programming comprises using Viterbi decoding.
 5. The method of claim 1, wherein the plurality of sequence reads represent at least a majority of a genome of an organism.
 6. The method of claim 1, further comprising: representing the first genotype AA, the second genotype AB, and the third genotype BB using a traversal graph comprising nodes connected by edges into a plurality of paths, the plurality of paths including a first traversal path representing the first genotype AA, a second traversal path representing the second genotype AB, and a third traversal path representing the third genotype BB; and determining weights for the first traversal path, the second traversal path, and the third traversal path based on properties of the sequence reads that map to the reference graph.
 7. The method of claim 6, further comprising enumerating a plurality of genotypes from the reference graph, representing the plurality of genotypes as paths in the traversal graph, and identifying the most likely sequence of genotypes by determining a most probable path through the traversal graph.
 8. The method of claim 7, wherein identifying the most likely sequence of genotypes by determining a most probable path through the traversal graph comprises using dynamic programming.
 9. The method of claim 8, wherein using dynamic programming comprises using a Dijkstra operation to find a least-cost path.
 10. The method of claim 1, wherein A represents an allele of a gene known to be dominant and B represents an allele of the gene known to be recessive.
 11. The method of claim 10, wherein the organism is a patient, the method further comprising providing a report for the patient that reports the identified one of the first genotype AA, the second genotype AB, and the third genotype BB.
 12. The method of claim 1, wherein providing a reference graph further comprises obtaining the plurality of genomic sequences and transforming the plurality of genomic sequences into a reference graph, wherein matching homologous segments of the known sequences are each represented by a single object in the reference graph.
 13. The method of claim 12, wherein matching homologous segments of the plurality of genomic sequences are each represented by a single node.
 14. The method of claim 12, wherein assigning scores to each of the identified genotypes comprises determining the likelihood of sequence reads mapping to each edge of a reference graph given each possible state.
 15. A system for determining a genotype, the system comprising a processor coupled to a tangible memory subsystem having stored therein: a reference graph representing a plurality of genomic sequences and comprising nodes connected by edges into a plurality of paths, wherein variation across the plurality of genomic sequences is incorporated as divergent paths converging to nodes representing conserved sequence, such that each of the plurality of genomic sequences is represented as a path in the reference graph; wherein the plurality of paths further comprises a first alternate path representing a first haplotype A at a position and a second alternate path representing a second haplotype B at the position, wherein each of the first and second alternate paths converge to a node representing a conserved sequence; and instructions that when executed by the processor cause the system to: identify one or more genotypes corresponding to either or both of the first haplotype A and the second haplotype B, the one or more genotypes comprising a first genotype AA, a second genotype AB, and a third genotype BB; map a plurality of sequence reads from an organism to the reference graph, wherein the mapping comprises looking backwards to predecessor paths to identify an optimal location for a sequence read across multiple alternate paths; assign—based on properties of the mapped plurality of sequence reads to the reference graph—scores to each of the identified genotypes, wherein the assigning considers whether a sequence read mapping to the first haplotype A changes the probability of the genotype including the second haplotype B; and identify one of the first genotype AA, second genotype AB, or third genotype BB as having a highest score in said assigning step, thereby providing a genotype.
 16. The system of claim 15, wherein the instructions are further operable to: represent the first genotype AA, the second genotype AB, and the third genotype BB using a traversal graph comprising nodes connected by edges into a plurality of paths, the plurality of paths including a first traversal path representing the first genotype AA, a second traversal path representing the second genotype AB, and a third traversal path representing the third genotype BB; and determine weights for the first traversal path, the second traversal path, and the third traversal path based on numbers of the sequence reads that map to the traversal graph.
 17. The system of claim 16, wherein the instructions are further operable to: enumerate a plurality of genotypes from the reference graph; represent the plurality of genotypes as paths in the traversal graph; and identify the most likely sequence of genotypes by determining a most probable path through the traversal graph.
 18. The system of claim 17, wherein identifying the most likely sequence of genotypes by determining a most probable path through the traversal graph comprises using dynamic programming.
 19. The system of claim 18, wherein using dynamic programming comprises using a Dijkstra operation to find a least-cost path.
 20. The system of claim 15, wherein the organism is a patient and the system is operable to provide a report for the patient that gives the identified one of the first genotype AA, the second genotype AB, and the third genotype BB. 